<template>
	<view>
		
		<cu-custom bgColor="bg-gradual-blue" :isBack="fasle">
			<block slot="content">任务列表</block>
		</cu-custom>
		<view class="cu-card case isCard">
			<view class="cu-item shadow" v-for="(item,index) in list" :key="index" @click="goDetail(item._id)">
				<view class="text-content padding-sm text-cut" style="width:100%;">
					
					<view class="">
						时间:{{item.time}}
					</view>
					<view class="">
						赏金:{{item.price}}
					</view>
				</view>
				<view class="content flex-sub">
					<view class="text-gray flex justify-around padding-bottom">
						<view>{{item.status==1?"√已被接单":"×未被接单"}}</view>
						<view><text class="cuIcon-attentionfill"></text> {{item.view_num}}</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 加号，跳转到添加页面 -->
		<uni-fab @fabClick="toAdd" :popMenu="false"></uni-fab>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				unLogin: true,
				list:[]
			}
		},
		onLoad: function(){
			this.getList()
			
		},
		onPullDownRefresh(){
			this.getList();
		},
		methods: {
			getList:function(){
				uniCloud.callFunction({
					name: "getAllTask",
					success:(res)=>{
						this.list=res.result.data.reverse()
						uni.stopPullDownRefresh()
					}
				})
			},
			goDetail: function(id) {
				uni.navigateTo({
					url:"/pages/user/mypublish/detail?id="+id
				});
			},
			toAdd(){
				uni.navigateTo({
					url:"/pages/take/add"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.cu-card {
	display: block;
	overflow: auto!important;
	height: calc(100vh - 120upx);
}
</style>
